package com.xauto.pioneer.appuser.model;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Ellis.Li on 2017/5/12.
 */
public class CarOrderOtherDetailInfo extends BaseModel<CarOrderOtherDetailInfo> {

    /** ID*/
    public String additional_order_id;
    /** 名称*/
    public String car_order_no;
    /** 名称*/
    public String plate_no;
    /** 名称*/
    public String additional_amount;
    /** 金额*/
    public String additional_amount_foramt;
    /** 附加订单分类*/
    public String additional_order_category_name;
    /**附加订单状态*/
    public String additional_order_status_name;
    /** 1,0-黑色/1-红色/2-灰色*/
    public String additional_order_status_style_color;
    /** 附加订单状态描述*/
    public String additional_order_status_description;
    /** 备注*/
    public String additional_order_status_comment;
    public List<String> Other_image_list;
    @Override
    public CarOrderOtherDetailInfo parse(JSONObject jsonObject) {
        if(jsonObject != null) {
            additional_order_id = jsonObject.optString("additional_order_id");
            car_order_no = jsonObject.optString("car_order_no");
            plate_no= jsonObject.optString("plate_no");
            additional_amount = jsonObject.optString("additional_amount");
            additional_amount_foramt = jsonObject.optString("additional_amount_foramt");
            additional_order_category_name = jsonObject.optString("additional_order_category_name");
            additional_order_status_name = jsonObject.optString("additional_order_status_name");
            additional_order_status_style_color = jsonObject.optString("additional_order_status_style_color");
            additional_order_status_description = jsonObject.optString("additional_order_status_description");
            additional_order_status_comment = jsonObject.optString("additional_order_status_comment");
            JSONArray imageList = jsonObject.optJSONArray("images");
            Other_image_list=new ArrayList();
            if (imageList != null && imageList.length() > 0){
                for (int i=0,size = imageList.length();i<size;i++){
                    Image image = new Image().parse(imageList.optJSONObject(i));
                    // refuel_image_list.add(image);
                    Other_image_list.add(image.image.toString());
                }

            }
            return this;
        }
        return null;
    }
}
